package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {
    @Select("SELECT COUNT(*) FROM setmeal WHERE category_id = #{id}")
    public Integer countByCategoryId(Long id);


    Page<SetmealVO> pageSetmeal(SetmealPageQueryDTO setmealPageQueryDTO);


    @AutoFill(value= OperationType.INSERT)
    void insertSetmeal(Setmeal setmeal);

    @Select("SELECT * FROM setmeal WHERE id = #{id}")
    Setmeal getSetmealById(Long id);

    @AutoFill(value= OperationType.UPDATE)
    void updateSetmeal(Setmeal setmeal);

    void deleteSetmeal(List<Long> ids);

}
